home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / vbmask.zip / MASKDEMO.TXT < prev   
Text File  |  1991-09-06  |  1KB  |  55 lines

  1. DefInt A-Z
  2.  
  3. Declare Function BitBlt Lib "Gdi" (ByVal destHdc, ByVal X, ByVal Y, ByVal w, ByVal h, ByVal srcHdc, ByVal srcX, ByVal srcY, ByVal Rop As Long)
  4.  
  5. Const SRCAND = &H8800C6
  6. Const SRCINVERT = &H660046
  7.  
  8. Sub Form_Paint ()
  9.     
  10.     ' ** Display something random text on the form **
  11.     '
  12.     Cls
  13.     CurrentY = Command1.Top + Command1.Height
  14.     Rows = (ScaleHeight - CurrentY) \ TextHeight(" ")
  15.     
  16.     For Y = 1 To Rows
  17.         Print "DESTINATION DESTINATION"
  18.     Next Y
  19.     
  20. End Sub
  21.  
  22. Sub Form_Resize ()
  23.     Refresh
  24. End Sub
  25.  
  26. Sub Command1_Click ()
  27.     
  28.     Refresh
  29.  
  30.     ' ** Display Bitmap with center of it being transparent
  31.     ' Logic is:  (Dest AND Mask) XOR Image
  32.     '
  33.     YDest = Command1.Top + Command1.Height
  34.     
  35.     R = BitBlt(Hdc, 0, YDest, Pic_Mask.Width, Pic_Mask.Height, Pic_Mask.Hdc, 0, 0, SRCAND)
  36.     R = BitBlt(Hdc, 0, YDest, Pic_Image.Width, Pic_Image.Height, Pic_Image.Hdc, 0, 0, SRCINVERT)
  37.  
  38.     XDest = Pic_Image.Width + 1
  39.     R = BitBlt(Hdc, XDest, YDest, Pic_Mask.Width, Pic_Mask.Height, Pic_Mask.Hdc, 0, 0, SRCAND)
  40.     R = BitBlt(Hdc, XDest, YDest, Pic_Image.Width, Pic_Image.Height, Pic_Image.Hdc, 0, 0, SRCINVERT)
  41.  
  42. End Sub
  43.  
  44. Sub Command2_Click ()
  45.  
  46.     Refresh
  47.  
  48. End Sub
  49.  
  50. Sub Form_Load ()
  51.  
  52.     Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
  53. End Sub
  54.  
  55.